package com.java1412.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author java1412
 * @since 2024-04-22 16:26:18
 */
@RestController
@RefreshScope // 刷新最新配置信息
public class HelloController {

    // 注入远程配置文件的属性的值
    @Value("${foo}")
    private String foo;

    @GetMapping(value = "/hi")
    public String hi() {
        return foo;
    }
}
